package com.hyt.it.ogt.controller.ykcj.grade;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hyt.it.ogt.controller.base.BaseController;
import com.hyt.it.ogt.ykcj.common.annotation.Log;
import com.hyt.it.ogt.ykcj.common.core.domain.AjaxResult;
import com.hyt.it.ogt.ykcj.common.core.page.TableDataInfo;
import com.hyt.it.ogt.ykcj.common.enums.BusinessType;
import com.hyt.it.ogt.ykcj.common.utils.poi.ExcelUtil;
import com.hyt.it.ogt.ykcj.domain.grade.ServantPassAnalysisData;
import com.hyt.it.ogt.ykcj.service.grade.IServantPassAnalysisDataService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiSort;

/**
 * 公务员考试合格及通过分析Controller
 *
 * @author admin
 * @date 2021-10-13
 */
@Api(tags = "grade.7.公务员考试合格及通过分析", value = "公务员考试合格及通过分析请求接口")
@ApiSort(value = 207)
@RestController
@RequestMapping("/grade/servantPassAnalysisData")
public class ServantPassAnalysisDataController extends BaseController {

  @Autowired
  private IServantPassAnalysisDataService servantPassAnalysisDataService;

  /**
   * 查询公务员考试合格及通过分析列表
   */
  @GetMapping("/list")
  public TableDataInfo list(ServantPassAnalysisData servantPassAnalysisData) {
    startPage();
    List<ServantPassAnalysisData> list = servantPassAnalysisDataService
        .selectServantPassAnalysisDataList(servantPassAnalysisData);
    return getDataTable(list);
  }

  /**
   * 导出公务员考试合格及通过分析列表
   */
  @Log(title = "公务员考试合格及通过分析", businessType = BusinessType.EXPORT)
  @GetMapping("/export")
  public AjaxResult export(ServantPassAnalysisData servantPassAnalysisData) {
    List<ServantPassAnalysisData> list = servantPassAnalysisDataService
        .selectServantPassAnalysisDataList(servantPassAnalysisData);
    ExcelUtil<ServantPassAnalysisData> util = new ExcelUtil<ServantPassAnalysisData>(
        ServantPassAnalysisData.class);
    return util.exportExcel(list, "公务员考试合格及通过分析数据");
  }

  /**
   * 获取公务员考试合格及通过分析详细信息
   */
  @GetMapping(value = "/{id}")
  public AjaxResult getInfo(@PathVariable("id") String id) {
    return AjaxResult.success(servantPassAnalysisDataService.selectServantPassAnalysisDataById(id));
  }

}
